//
// Created by 11510 on 2024/7/17.
//

#ifndef INC_02_EVENT_PASS_MYLABEL_H
#define INC_02_EVENT_PASS_MYLABEL_H

#include <QtWidgets/QtWidgets>

class MyLabel : public QLabel {
Q_OBJECT
public:
    MyLabel(QWidget *parent = nullptr) : QLabel(parent) {}

    bool event(QEvent *e) override {
        if (e->type() == QEvent::MouseButtonRelease) {
            qDebug() << "event object = " << this->objectName();
        }
        return QLabel::event(e);
    }

    void mouseReleaseEvent(QMouseEvent *ev) override {
        qDebug() << "event handler object = " << this->objectName();
    }
};


#endif //INC_02_EVENT_PASS_MYLABEL_H
